package demo1;
class Person{
    String name;
    int age;
    public Person(String name,int age)
    {
        this.name = name;
        this.age = age;
    }

    @Override
    public boolean equals(Object obj) {
        Person person = (Person)obj;
        if(this.name.equals(person.name)&&this.age == person .age)
            return true;
        return false;
    }


}
public class Test {
    public static void main(String[] args) {
        Person person = new Person("张山",23);
        Person person1 = new Person("张山",23);
        System.out.print(person.equals(person1));
    }

}
